home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
thelp4.zip
/
THELP4.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1988-03-04
|
39KB
|
841 lines
{$R-} {Range checking off}
{$B+} {Boolean complete evaluation on}
{$S+} {Stack checking on}
{$I+} {I/O checking on}
{$N-} {No numeric coprocessor}
{$M 1024,0,3072}
{ Program THELP was originally written by a Mr. Glenn Wood of the Greenville PC Club of
Greenville, Texas. This updated version was reprogrammed by John Sloan, AlphaOmega
Computer Services, Devon, Alberta (CIS 71310,2267). It is entirely memory
resident and takes up about 46,944 K of memory space. It has been tested on
PCjr, PC CGA, EGA, PS2 VGA, MCGA. To keep the memory size down, many of the
original Procedure and Function help screens have been deleted. These, however,
are still available from the Turbo 4.0 editor using either <F1> or <ALT-F1>.
Thelp 4.0 now installs correctly on the PCjr and searches for any available
user interrupt between 60H and 67H. If it finds an available slot it will
install itself, otherwise it will abort with an error message. Thelp 4.0
will also detect whether it has already been installed or not. The window
routines have been borrowed from Eric Snyder's excellent Minigen vs 1.3
screen generator. This program uses Snyder's MGProg.TPU unit to compile.
}
PROGRAM THELP;
{ $C-}
{VARIABLE SECTION FOR 'THELP'}
Uses
Crt,
Dos,
MGProg;
const
EntryChar = 35; { ALT 'H' }
Escape = 0;
FirstRow = 3;
FirstCol = 11;
WindowWidth = 60;
WindowLength = 18;
Dr = 3;
Mr = 15;
Cr = $0D;
KybdInt = $16;
maxpage = 5; {maximum # of pages for each menu item}
Maxline = 68;
Type
text80 = string[80];
Str80 = string[80];
FldTyp = Record
Typ : Char;
Col,Row,Atr,Len : Byte;
Txt : Str80;
End;
ScreenArray = Array[1..Maxline] of Fldtyp;
var
UserInt : byte;
exitcode : word;
reg : Registers;
i,j,x,y : integer;
Selection : integer;
Vector1,
Vector2 : Pointer;
pagetop : array[1..maxpage] of byte;
page : byte;
Esc : boolean;
{ MISC. PROCEDURES AND FUNTIONS FOR THELP }
procedure Brite(line:text80);
begin
textcolor(15);
write(line);
textcolor(7);
end;
procedure PrintHeading;
begin
brite('T'); write('URBO Pascal ');
brite('Help '); write('Ver 4.0');
end;
{ MENU PRINT PROCEDURES FOR THELP }
procedure PrintMenu(number:integer);
begin
case number of
0 : begin
gotoxy(mr+4,2); PrintHeading;
gotoxy(mr+7,5); brite('MAIN MENU');
gotoxy(mr,6); write('<1> Syntax Structure');
gotoxy(mr,7); write('<2> Compiler Directives');
gotoxy(mr,8); write('<3> Fatal Runtime Errors');
gotoxy(mr,9); write('<4> I/O Errors and Dos Errors');
gotoxy(mr,10); write('<5> Reserved Words');
gotoxy(mr,11); write('<6> Keyboard Scan codes');
end;
1 : begin
gotoxy(mr+4,2); PrintHeading;
gotoxy(mr+6,5); brite('SYNTAX STRUCTURE MENU');
gotoxy(mr,6); write('<1> Types and Type Casting');
gotoxy(mr,7); write('<2> Constants and Typed Constants');
gotoxy(mr,8); write('<3> Variables');
gotoxy(mr,9); write('<4> Operators');
gotoxy(mr,10); write('<5> Program Structure');
gotoxy(mr,11); write('<6> Procedure and Function Structure');
gotoxy(mr,12); write('<7> Unit Structure');
gotoxy(mr,13); write('<8> Statements');
end;
end;{case}
repeat
gotoxy(14,18); Brite('Enter Selection or <ESC> to Exit ');
reg.ax := $00;
Intr(userint,reg);
selection:=reg.ah -1
until ((selection in [0..9]) and (number = 0))
or ((selection in [0..8]) and (number = 1));
clrscr;
end;
Procedure WriteScreen(Numfields:byte; Var FieldsArray);
Type
ScreenArray = Array[1..Maxline] of Fldtyp;{allows variable length arrays
to be passed in as an untyped
variable and then typecast to
this array type}
Var i,j,k:byte;
key :char;
procedure Pause(var key:char);
Var ch:char;
begin Case key of
'1':begin
gotoxy(22,18); brite('<PgDn>');write(' for next PAGE');
Repeat until Keypressed;
Repeat
ch:=Readkey;
if ord(ch) = 00 then
ch:=readkey;
if (ord(ch)= 81) or (ord(ch)=51) then key:='D';
Until ord(ch) in [51,81];
end;
'E':begin
gotoxy(12,18); brite('<PgUp> ');write('for previous page or ');brite('<Esc> for MENU');
Repeat until Keypressed;
Repeat
ch:=Readkey;
if ord(ch) = 00 then
ch:=readkey;
if (ord(ch)= 73) or (ord(ch)=57) then key:='U';
if (ord(ch)= 01) then key:='E';
Until ord(ch) in [57,73,$1B];
end;
'U','D':begin
gotoxy(12,18); brite('<PgUp> ');write('for previous page or ');brite('<PgDn>');
write(' for next PAGE');
Repeat until Keypressed;
Repeat
ch:=Readkey;
if ord(ch) = 00 then
ch:=readkey;
if (ord(ch)= 73) or (ord(ch)=57) then key:='U';
if (ord(ch)= 81) or (ord(ch)=51) then key:='D';
Until ord(ch) in [51,57,73,81];
end;
end;{case}
clrscr;
end; {Pause}
Begin {WriteScreen}
pagetop[1]:=1;
I:=1;
page:=1;
Esc:=False;
key:='1';
Repeat
With ScreenArray(FieldsArray)[I] do WinRite(Txt,Col,Row,Atr);
I:=I+1;
If (ScreenArray(Fieldsarray)[I].Row =1) or (I = Numfields +1) then
begin
If I = Numfields + 1 then key :='E';
Pause(key);
case key of
'U':If page <> 1 then
begin
I:=pagetop[page-1];
page:=page-1;
If page = 1 then
key:='1';
end;
{else
begin
I:=1;
key:='1';
end;}
'D':begin
page:=page+1;
pagetop[page]:=I
end;
'E':Esc:=True;
end;{Case}
end; {if}
Until Esc;
end; {WriteScreen}
procedure Wait;
begin
gotoxy(17,18); brite('Press <ESC> To Return to MENU');
repeat
reg.ax := 0;
Intr(userint,reg);
until reg.ah = $01;
clrscr;
end;
procedure PrintType;
Type
Str80 = string[80];
FldTyp = Record
Typ : Char;
Col,Row,Atr,Len : Byte;
Txt : Str80;
End;
Const
NumFields = 28;
FieldsArray : Array[1..Numfields] of Fldtyp =
(
(Typ:'T';Col:23;Row:1;Atr:31;Len:60;Txt:'TYPES (pg. 207)'),
(Typ:'T';Col:2;Row:2;Atr:31;Len:60;Txt:' Simple Type: (pg. 208)'),
(Typ:'T';Col:2;Row:3;Atr:23;Len:60;Txt:' days = 1..30; {Ordinal}'),
(Typ:'T';Col:2;Row:4;Atr:23;Len:60;Txt:' day = (monday,tuesday,wednesday,thursday,'),
(Typ:'T';Col:2;Row:5;Atr:23;Len:60;Txt:' friday,saturday,sunday); {Enumerated}'),
(Typ:'T';Col:2;Row:6;Atr:23;Len:60;Txt:' letter = ''a''..''z''); {subrange}'),
(Typ:'T';Col:2;Row:7;Atr:23;Len:60;Txt:' Hex = byte; {0..255}'),
(Typ:'T';Col:2;Row:8;Atr:23;Len:60;Txt:' Smallnum = shortint; {-128..127}'),
(Typ:'T';Col:2;Row:9;Atr:23;Len:60;Txt:' A/D_range = integer; {-32768..32767}'),
(Typ:'T';Col:2;Row:10;Atr:23;Len:60;Txt:' Address = word; {0..65535}'),
(Typ:'T';Col:2;Row:11;Atr:31;Len:60;Txt:' Boolean Type: (pg. 210)'),
(Typ:'T';Col:2;Row:12;Atr:23;Len:60;Txt:' Switch = boolean {False < True}'),
(Typ:'T';Col:2;Row:13;Atr:31;Len:60;Txt:' Char type: (pg. 210)'),
(Typ:'T';Col:2;Row:14;Atr:23;Len:60;Txt:' C = char {''A''..''Z'',''a''..''z'',''0''..''9''}'),
(Typ:'T';Col:23;Row:1;Atr:31;Len:60;Txt:'TYPES (con''t)'),
(Typ:'T';Col:2;Row:2;Atr:31;Len:60;Txt:' Real type